package com.hksj.acm.controller;

import com.hksj.acm.dto.HistoryCurveDTO;
import com.hksj.acm.service.DeviceService;
import com.hksj.acm.vo.CoreParamMonitorDataVO;
import com.hksj.acm.vo.DeviceAttributeVO;
import com.hksj.acm.vo.DeviceVO;
import com.hksj.acm.vo.HistoryCurveVO;
import com.hksj.cbm.dto.DeviceDTO;
import com.hksj.cbm.vo.DeriveMetadataVO;
import com.hksj.common.core.model.Rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @author fjt
 * @data 2024/7/10 15:17
 * @describe
 */
@Api(tags = "空调机组-设备列表")
@RestController
@RequestMapping("/api/acm/devices")
public class DeviceController {


    @Autowired
    private DeviceService deviceService;


    @PostMapping("/list")
    @ApiOperation(value = "设备列表查询(同时查询设备配置的全部监测数据)", notes = "设备列表查询(同时查询设备配置的全部监测数据)",response = DeviceVO.class)
    public Rest<List<DeviceVO>> deviceList(@RequestBody DeviceDTO dto){
        return Rest.ok(deviceService.deviceList(dto));
    }


    @PostMapping("/withoutDataList")
    @ApiOperation(value = "设备列表查询(不带监测数据)", notes = "设备列表查询(不带监测数据)",response = DeviceVO.class)
    public Rest<List<DeviceVO>> deviceWithoutDataList(@RequestBody DeviceDTO dto){
        return Rest.ok(deviceService.deviceWithoutDataList(dto));
    }


    @GetMapping("/monitorData/{deviceId}")
    @ApiOperation(value = "查询指定设备的全部监测指标数据", notes = "查询指定设备的全部监测指标数据",response = DeviceAttributeVO.class)
    public Rest<List<DeviceAttributeVO>> monitorDataByDeviceId(@PathVariable("deviceId") String deviceId){
        return Rest.ok(deviceService.monitorDataByDeviceId(deviceId));
    }


    @GetMapping("/coreParamMonitorData/{deviceId}")
    @ApiOperation(value = "查询指定设备的核心参数监测数据", notes = "查询指定设备的核心参数监测数据",response = CoreParamMonitorDataVO.class)
    public Rest<List<CoreParamMonitorDataVO>> queryCoreParamMonitorData(@PathVariable("deviceId") String deviceId){
        return Rest.ok(deviceService.queryCoreParamMonitorData(deviceId));
    }


    @PostMapping("/historyCurve")
    @ApiOperation(value = "指定设备的历史曲线查询", notes = "指定设备的历史曲线查询",response = HistoryCurveVO.class)
    public Rest<List<HistoryCurveVO>> queryHistoryCurve(@RequestBody @Valid HistoryCurveDTO dto){
        return Rest.ok(deviceService.queryHistoryCurve(dto));
    }



}
